const mongoose = require('mongoose')
const Schema = mongoose.Schema

//实例化数据模板
const UserSchema = new Schema({
  account: {
    type: String,
    required: true
  },
  name: {
    type: String,
    required: true
  },
  email: {
    type: String,
    required: true
  },
  password: {
    type: String,
    required: true
  },
  ID: {
    type: String,
    required: true
  },
  avatar: {
    type: String,
  },
  date: {
    type: Date,
    default: Date.now()
  },
  admin: {
    type:String,
    default: 'false'
  },
  isLogin: {
    type: Boolean,
    default: false
  },
  code: {
    type: Number,
    default: 5000
  },
  phone: {
    type: String,
    required: true
  },
})

module.exports = User = mongoose.model('users', UserSchema)
